#!/bin/bash
cd "$(dirname "$0")" || exit 1

# 创建必要的目录
mkdir -p upload
mkdir -p public
mkdir -p ../../logs

# 安装依赖（如果需要）
if [ ! -d "node_modules" ]; then
    echo "Installing dependencies..."
    npm install
fi

# 启动服务器
echo "Starting OHOS Axios Server..."
nohup npm run start > ../../logs/axios_server.log 2>&1 &

echo "✅ OHOS Axios Server started (PID: $!)"
echo "📋 Log file: ../../logs/axios_server.log"